<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>设备列表</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link href="/CarHistory/css/imeilist.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <h1>设备列表</h1>      

    <div style="width:1355px;">
        <div class="mini-toolbar" style="border-bottom:0;padding:0px;">
            <table style="width:100%;">
                <tr>
                    <td style="white-space:nowrap;">
                        <input id="key" class="mini-textbox" emptyText="请输入设备号" style="width:150px;" onenter="onKeyEnter"/>   
                        <a class="mini-button" onclick="search()">查询</a>
                        <a class="mini-button" onclick="synchronization()" href="/CarHistory/devinfo/synDevInfo">同步设备</a>
                    </td>
                    <td style="white-space:nowrap;">
                        <a class="mini-button" href="/CarHistory/mileage/mileagelist">里程列表</a>
                    </td>
                </tr>
            </table>           
        </div>
    </div>
    <div id="datagrid1" class="mini-datagrid" style="width:1355px;height:570px;" allowResize="true"
        url="/CarHistory/devinfo/getDevList" multiSelect="true" >
        <div property="columns">
            <!--<div type="indexcolumn"></div>        -->
            <div type="checkcolumn" ></div>        
            <div field="imei" width="120" headerAlign="center" allowSort="true">设备号</div>      
            <div field="name" width="120" headerAlign="center" allowSort="true">设备名称</div> 
            <div field="number" width="120" headerAlign="center" allowSort="true">车牌号</div> 
            <div field="in_time" width="120" headerAlign="center" dateFormat="yyyy-MM-dd hh:mm:ss" allowSort="true">开通时间</div> 
            <div field="out_time" width="120" headerAlign="center" dateFormat="yyyy-MM-dd hh:mm:ss" allowSort="true">到期时间</div> 
            <div field="" width="100" headerAlign="center" allowSort="true">最后位置</div> 
                                 
        </div>
    </div>
    
	<script src="/CarHistory/miniui/boot.js" type="text/javascript"></script>
    <script type="text/javascript">
        mini.parse();
        var grid = mini.get("datagrid1");
        grid.load();
       	function add(){
       		mini.open({
                url: bootPATH + "../addimei.html",
                title: "新增设备", width: 600, height: 360,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var data = { action: "new"};
                    iframe.contentWindow.SetData(data);
                },
                ondestroy: function (action) {
                    grid.reload();
                }
            });
       	}
       	function remove() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                if (confirm("确定删除选中记录？")) {
                    var ids = [];
                    for (var i = 0, l = rows.length; i < l; i++) {
                        var r = rows[i];
                        ids.push(r.id);
                    }
                    var id = ids.join(',');
                    grid.loading("操作中，请稍后......");
                    $.ajax({
                        url: "/CarHistory/GpsData/delImei",
                        type: 'post',
                		data: { data: id },
                        success: function (text) {
                            grid.reload();
                        },
                        error: function () {
                        }
                    });
                }
            } else {
                alert("请选中一条记录");
            }
        }
        
        function search() {
            var key = mini.get("key").getValue();
            alert(key);
            grid.load({ key : key });
        }
        function onKeyEnter(e) {
            search();
        }
    </script>

</body>
</html>